package com.yijumao.service.impl;

import com.yijumao.dao.UserDao;
import com.yijumao.entity.User;
import com.yijumao.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    @Override
    public List<User> findAll() {
        return userDao.selectList(null);
    }

    @Override
    public User findById(Integer uid) {
        return userDao.selectById(uid);
    }

    @Override
    public void update(User user) {
        userDao.updateById(user);
    }

    @Override
    public void delete(Integer uid) {
        userDao.deleteById(uid);
    }

    @Override
    public void add(User user) {
        userDao.insert(user);
    }

}
